<template>
    <div>
        <el-card class="!border-none" shadow="never">
            <el-form ref="formRef" class="mb-[-16px]" :model="queryParams" :inline="true" @submit.native.prevent>
                <el-form-item :label="$t('关键词')">
                    <el-input class="w-[280px]" v-model="queryParams.keyword" :placeholder="$t('请输入关键词')" clearable
                        @keyup.enter="resetPage" />
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="resetPage">{{ $t('查询') }}</el-button>
                    <el-button @click="resetParams">{{ $t('重置') }}</el-button>
                </el-form-item>
            </el-form>
        </el-card>
        <el-card class="!border-none mt-4" shadow="never">
            <el-table size="large" class="mt-4" v-loading="pager.loading" :data="pager.lists">
                <el-table-column :label="$t('ID')" prop="id" min-width="120" />
                <el-table-column :label="$t('地区语言')" prop="name" min-width="100" />
                <el-table-column :label="$t('国际代码')" prop="code" min-width="120" />
            </el-table>
            <div class="flex justify-end mt-4">
                <pagination v-model="pager" @change="getLists" />
            </div>
        </el-card>
    </div>
</template>
<script lang="ts" setup name="country">
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
import { usePaging } from '@/hooks/usePaging'
import { langCountryLists } from '@/api/setting/lang'
const queryParams = reactive({
    keyword: ''
})

const { pager, getLists, resetPage, resetParams } = usePaging({
    fetchFun: langCountryLists,
    params: queryParams
})


getLists()
</script>
